{% extends "layouts/base.html" %}
{% load i18n l10n admin_urls static %}

{% block extrahead %}
    {{ block.super }}
    {{ media }}
    <script type="text/javascript" src="{% static 'admin/js/cancel.js' %}"></script>
{% endblock %}

{#{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} delete-confirmation#}
{#    delete-selected-confirmation{% endblock %}#}

{% if not is_popup %}
    {% block breadcrumbs %}
        <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center py-4">
            <div class="d-block mb-4 mb-md-0">
                <nav aria-label="breadcrumb" class="d-none d-md-inline-block">
                    <ol class="breadcrumb breadcrumb-dark breadcrumb-transparent">
                        <li class="breadcrumb-item">
                            <a href="{% url 'admin:index' %}">
                                <svg class="icon icon-xxs" fill="none" stroke="currentColor" viewBox="0 0 24 24"
                                     xmlns="http://www.w3.org/2000/svg">
                                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                          d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
                                </svg>
                            </a>
                        </li>
                        <li class="breadcrumb-item">
                          <a href="{% url 'admin:app_list' opts.app_config.label %}">
                            {{ opts.app_config.verbose_name }}
                          </a>
                        </li>

                        <li class="breadcrumb-item">
                            <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
                        </li>

                        <li class="breadcrumb-item">{% trans 'Delete multiple objects' %}</li>
                    </ol>
                </nav>
            </div>
        </div>
    {% endblock %}
{% endif %}

{% block content %}
        <div class="row mx-3 mt-5">
            <div class="col-md-12 mb-4">
                <div class="card">
                    <div class="card-header">
                        <div class="card-title">
                            {% if perms_lacking %}
                                <p class="txt-left-dir">
                                    {% blocktrans %}
                                        Deleting the selected {{ objects_name }} would result in deleting related
                                        objects, but your account doesn't have permission to delete the following
                                        types of objects:
                                    {% endblocktrans %}
                                </p><br>

                                <div class="{{ direction.panel }}">
                                    <blockquote>
                                        <ul class="blockquote blockquote-primary">
                                            {% for obj in perms_lacking %}
                                                <li>{{ obj }}</li>
                                            {% endfor %}
                                        </ul>
                                    </blockquote>
                                </div>
                            {% elif protected %}
                                <p class="txt-left-dir">
                                    {% blocktrans %}
                                        Deleting the selected {{ objects_name }} would require deleting the
                                        following protected related objects:
                                    {% endblocktrans %}
                                </p><br>

                                <div class="{{ direction.panel }}">
                                    <blockquote>
                                        <ul class="blockquote blockquote-primary">
                                            {% for obj in protected %}
                                                <li>{{ obj }}</li>
                                            {% endfor %}
                                        </ul>
                                    </blockquote>
                                </div>
                            {% else %}
                                <p class="txt-left-dir">
                                    {% blocktrans %}
                                        Are you sure you want to delete the selected {{ objects_name }}? All of the
                                        following objects and their related items will be deleted:
                                    {% endblocktrans %}
                                </p>
                            {% endif %}
                        </div>
                    </div>
                    <div class="card-body {{ direction.panel }}">
                        {% if not perms_lacking and not protected %}
                            {% include "admin/includes/object_delete_summary.html" %}

                            <div>
                                <blockquote>
                                    <h3>{% trans "Objects" %}</h3>
                                    <ul class="blockquote blockquote-primary">
                                        {% for deletable_object in deletable_objects %}
                                            {{ deletable_object|unordered_list }}
                                        {% endfor %}
                                    </ul>
                                </blockquote>
                            </div>

                            <form method="post">
                                {% csrf_token %}
                                <div>
                                    {% for obj in queryset %}
                                        <input type="hidden" name="{{ action_checkbox_name }}"
                                               value="{{ obj.pk|unlocalize }}">
                                    {% endfor %}
                                    <input type="hidden" name="action" value="delete_selected">
                                    <input type="hidden" name="post" value="yes">
                                    <button type="submit" class="btn btn-sm btn-primary">
                                        {% trans "Yes, I'm sure" %}
                                    </button>
                                    <a href="{% url opts|admin_urlname:'changelist' %}" class="btn btn-sm btn-warning">{% trans "No, take me back" %}</a>
                                </div>
                            </form>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
{% endblock %}
